<template>
  <div class="tech-showcase">
    <!-- 导航栏 -->
    <nav class="navbar">
      <h1>技术展示平台</h1>
    </nav>

    <!-- 主内容区 -->
    <main class="content">
      <div class="showcase-container">
        <!-- 左侧名称列表 -->
        <aside class="tech-list">
          <div class="list-header">
            <h2>技术列表</h2>
          </div>
          <ul class="list-items">
            <li
              v-for="project in techProjects"
              :key="project.id"
              :class="['tech-item', { active: $route.path === project.routePath }]"
              @click="$router.push(project.routePath)"
            >
              {{ project.name }}
            </li>
          </ul>
        </aside>

        <!-- 右侧展示区域 -->
        <section class="tech-preview">
          <div class="preview-header">
            <h2>{{ currentProject?.name || '技术展示' }}</h2>
            <div class="preview-description">
              {{ currentProject?.description || '选择左侧的技术项目查看详情' }}
            </div>
          </div>
          <div class="preview-area">
            <!-- 路由视图 -->
            <router-view></router-view>
          </div>
        </section>
      </div>
    </main>
  </div>
</template>

<script lang="ts" setup>
import { computed } from 'vue'
import { useRoute } from 'vue-router'
import { techProjects } from './router'

const route = useRoute()
const currentProject = computed(() => {
  return techProjects.find((project) => project.routePath === route.path)
})
</script>

<style scoped>
.tech-showcase {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /* 苹果液态玻璃背景 */
  background: linear-gradient(135deg, #f0f4f8 0%, #d9e2ec 100%);
}

/* 全局玻璃效果样式 */
.glass-effect {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.05);
}

.navbar {
  /* 使用45度线性渐变实现中间分割的背景，左边白色右边黑色 */
  background-image: linear-gradient(-45deg, black 91%, white 50%);
  padding: 1rem 2rem;
  display: flex;
  justify-content: start;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.navbar h1 {
  margin: 0;
  font-size: 1.5rem;
  /* 使用mix-blend-mode确保文字在不同背景上的可读性 */
  mix-blend-mode: difference;
  color: white;
}

.content {
  flex: 1;
  padding: 2rem;
}

/* 展示页面样式 */
.showcase-container {
  display: grid;
  grid-template-columns: 1fr 3fr;
  gap: 2rem;
  height: 100%;
}

/* 左侧名称列表 - 苹果液态玻璃效果（增强透明效果） */
.tech-list {
  border-radius: 12px;
  padding: 1.5rem;
  /* 应用玻璃效果 - 降低不透明度使透明更明显 */
  background: rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.05);
}

.list-header h2 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.2rem;
  color: #1d1d1f;
  font-weight: 600;
}

.tech-item {
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  color: #3a3a3c;
  background: rgba(255, 255, 255, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.tech-item:hover {
  background: rgba(255, 255, 255, 0.6);
  transform: translateX(4px);
}

.tech-item.active {
  background: rgba(29, 155, 240, 0.2);
  color: #0071e3;
  font-weight: 600;
  border-color: rgba(29, 155, 240, 0.4);
}

/* 右侧展示区域 - 苹果液态玻璃效果（增强透明效果） */
.tech-preview {
  border-radius: 12px;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  /* 应用玻璃效果 - 降低不透明度使透明更明显 */
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.05);
}

.preview-header h2 {
  margin-top: 0;
  color: #1d1d1f;
  font-size: 1.5rem;
  font-weight: 600;
}

.preview-description {
  margin-bottom: 2rem;
  line-height: 1.6;
  color: #3a3a3c;
}

.preview-area {
  flex: 1;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.3);
  min-height: 400px;
}
</style>
